﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Design;
using System.Drawing.Imaging;
using System.Drawing.Text;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace RoleHelper
{
    public partial class Figura2D : Control
    {
        
        public Point posicion = new Point();
        public int radio;
        public char tipo;
        public Color interior;
        public Color borde;
        public Size tam = new Size();
        public Rectangle rect = new Rectangle();
        //Graphics dc;
        public Button btn = new Button();
        

        //Eventos
        public event OnCreateEventHandler Create;


        public Figura2D()
        {
            InitializeComponent();
        }

        protected override void OnPaint(PaintEventArgs pe)
        {
            //dc = pe.Graphics;
            Pen fondo = new Pen(interior);
            Pen linea = new Pen(borde);
            if (tipo == 'R')
            {
                //dc.DrawRectangle(fondo, rect);
            }
            base.OnPaint(pe);
        }

        protected virtual void OnCreate(CreateEventArgs e)
        {
            posicion = e.posicion;
            if (e.tipo == 'R')
            {
                tipo = e.tipo;
                tam = new Size(e.ancho, e.alto);
                rect = new Rectangle(posicion, tam);
            }
            else if (e.tipo == 'C')
            {
                tipo = e.tipo;
                radio = e.radio;
            }
            interior = e.interior;
            borde = e.borde;

        }

    }

    public class CreateEventArgs : System.EventArgs
    {
        public char tipo;
        public Point posicion = new Point();
        public int ancho, alto, radio;
        public Color interior;
        public Color borde;

        public CreateEventArgs(char etipo, Point eposicion, Color fondo, Color linea, params int[] valores)
        {
            if (etipo == 'R')
            {
                tipo = etipo;
                posicion = eposicion;
                interior = fondo;
                borde = linea;
                ancho = valores[0];
                alto = valores[1];
            }
            else if (etipo == 'C')
            {
                tipo = etipo;
                posicion = eposicion;
                interior = fondo;
                borde = linea;
                radio = valores[0];

            }
        }

    }

    public delegate void OnCreateEventHandler(object sender, CreateEventArgs e);

}
